package com.example.film.controller;

import com.example.film.entity.AreaWeekSell;
import com.example.film.entity.CinemaWeekSell;
import com.example.film.service.AreaWeekSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "省市每周票房信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("areaWeek/v1")
public class AreaWeekSellController {

    @Autowired
    private AreaWeekSellService areaWeekSellService;

    @ApiOperation("省市影院票房信息")
    @GetMapping("/areaSell")
    public List<AreaWeekSell> getAreaWeekSell(){
        return areaWeekSellService.findAreaWeekSell();
    }

    @ApiOperation("分页查询省市影院票房信息")
    @GetMapping("/area")
    public List<AreaWeekSell> getAreaWeekSellInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return areaWeekSellService.findAreaWeekSellInfo(pageNum, pageSize);
    }

    @ApiOperation("根据周数查询省市每周票房信息")
    @GetMapping("/week/{week}")
    public List<AreaWeekSell> getAreaWeekSellByWeek(@PathVariable Integer week){
        return areaWeekSellService.findAreaWeekSellByWeek(week);
    }

    @ApiOperation("根据周数查询每周总票房信息")
    @GetMapping("/total/{week}")
    public List<AreaWeekSell> getTotalSell(@PathVariable Integer week){
        return areaWeekSellService.findTotalSell(week);
    }
}
